/* $RCSFile: ADNDynReport.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynReport.cs $
 * $log$
 * Revision 19 2010/10/02 14:01:49  christian.surieux
 *   Corrected a bug in allmost everyADNDyn file for PrimaryFieldVualue
 * Revision 6 2010/08/06 19:56:33  christian.surieux
 *   Added Log to All cs files
 */

/* Copyrights Christian Surieux 2010 */
/* Class ADNDynReport */
/* Date 2010-01-06 16:12:06Z */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
    public class ADNDynReport : DynEntity
    {
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.report)
            {}

            public override Type DynType
            { get { return typeof(ADNDynReport); } }

            public override string DynTypename
            {   get{ return CrmStr.report;}}

            public override DynEntity Build()
            {   return new ADNDynReport();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynReport(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynReport(w,PrimaryFieldValue);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynReport(w,PrimaryKeyValue);}
        }

        static ADNDynReport(){new Ftor();} 

        public override bool HasOwningBusinessUnitProperty
        { get { return true; } }
        
        public ADNDynReport() : base() { }
        
        public ADNDynReport(CRMWrapperBase w,string PrimaryFieldValue)
            : base(w,CrmStr.report)
        {
            if ( PrimaryFieldValue != string.Empty )
                name = PrimaryFieldValue;
        }
        
        public ADNDynReport(CRMWrapperBase w,Guid CrmId) : base(w,CrmStr.report,CrmId) { }
        
        public ADNDynReport(CRMWrapperBase w,InternalDynamicEntity e) : base(w,CrmStr.report,e,null,null) { }
        
        public ADNDynReport(CRMWrapperBase w,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(w,CrmStr.report,e,prop,s) { }
        
        public ADNDynReport(ResetWrapperHandler fn,string PrimaryFieldValue)
            : base(fn,CrmStr.report)
        {
            if ( PrimaryFieldValue != string.Empty )
                name = PrimaryFieldValue;
        }
        
        public ADNDynReport(ResetWrapperHandler fn,Guid CrmId) : base(fn,CrmStr.report,CrmId) { }
        
        public ADNDynReport(ResetWrapperHandler fn,InternalDynamicEntity e) : base(fn,CrmStr.report,e,null,null) { }
        
        public ADNDynReport(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(fn,CrmStr.report,e,prop,s) { }

        /* Properties */

        [CrmDynAttribute(CrmStr.report)]
        public Guid reportid
        {
            get
            { return KeyPropertyValue(CrmStr.reportid); }
            set
            { AddKeyProperty(CrmStr.reportid,value); }
        }

        protected override void SetCrmIdProperty(Guid crmId)
        {
            if ( !dicProperty.ContainsKey(CrmStr.reportid) || KeyPropertyValue(CrmStr.reportid) != crmId )
                reportid = crmId;
        }
        public override Guid PrimaryKeyGuidValue
        {
            get
            { return reportid; }
            set { reportid = value; }
        }
        
        public override string PrimaryFieldName
        {
            get
            { return CrmStr.name; }
            set
            {}
        }

        /// <summary>
        /// Value contained in the PrimaryField for the DynEntity or empty if no PrimaryField
        /// </summary>
        public override string PrimaryFieldStringValue
        {
            get
            {
                return name;
            }
            set
            {
                name =   value;
            }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string bodybinary
        {
            get
            { return StringPropertyValue(CrmStr.bodybinary); }
            set
            { AddStringProperty(CrmStr.bodybinary,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string bodytext
        {
            get
            { return StringPropertyValue(CrmStr.bodytext); }
            set
            { AddStringProperty(CrmStr.bodytext,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string bodyurl
        {
            get
            { return StringPropertyValue(CrmStr.bodyurl); }
            set
            { AddStringProperty(CrmStr.bodyurl,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string customreportxml
        {
            get
            { return StringPropertyValue(CrmStr.customreportxml); }
            set
            { AddStringProperty(CrmStr.customreportxml,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string defaultfilter
        {
            get
            { return StringPropertyValue(CrmStr.defaultfilter); }
            set
            { AddStringProperty(CrmStr.defaultfilter,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string description
        {
            get
            { return StringPropertyValue(CrmStr.description); }
            set
            { AddStringProperty(CrmStr.description,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string filename
        {
            get
            { return StringPropertyValue(CrmStr.filename); }
            set
            { AddStringProperty(CrmStr.filename,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public int filesize
        {
            get
            { return NumberPropertyValue(CrmStr.filesize); }
            set
            { AddNumberProperty(CrmStr.filesize,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public bool iscustomreport
        {
            get
            { return BooleanPropertyValue(CrmStr.iscustomreport); }
            set
            { AddBooleanProperty(CrmStr.iscustomreport,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public bool ispersonal
        {
            get
            { return BooleanPropertyValue(CrmStr.ispersonal); }
            set
            { AddBooleanProperty(CrmStr.ispersonal,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public bool isscheduledreport
        {
            get
            { return BooleanPropertyValue(CrmStr.isscheduledreport); }
            set
            { AddBooleanProperty(CrmStr.isscheduledreport,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public int languagecode
        {
            get
            { return NumberPropertyValue(CrmStr.languagecode); }
            set
            { AddNumberProperty(CrmStr.languagecode,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string mimetype
        {
            get
            { return StringPropertyValue(CrmStr.mimetype); }
            set
            { AddStringProperty(CrmStr.mimetype,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public override string name
        {
            get
            { return StringPropertyValue(CrmStr.name); }
            set
            { AddStringProperty(CrmStr.name,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public Guid owningbusinessunit
        {
            get
            { return LookupPropertyValue(CrmStr.owningbusinessunit); }
            set
            { AddLookupProperty(CrmStr.owningbusinessunit,CrmStr.businessunit,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public Guid owninguser
        {
            get
            { return LookupPropertyValue(CrmStr.owninguser); }
            set
            { AddLookupProperty(CrmStr.owninguser,CrmStr.systemuser,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public Guid parentreportid
        {
            get
            { return LookupPropertyValue(CrmStr.parentreportid); }
            set
            { AddLookupProperty(CrmStr.parentreportid,CrmStr.report,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string parentreportName
        {
            get
            { return LookupPropertyName(CrmStr.parentreportid); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string queryinfo
        {
            get
            { return StringPropertyValue(CrmStr.queryinfo); }
            set
            { AddStringProperty(CrmStr.queryinfo,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public int reporttypecode
        {
            get
            { return PicklistPropertyIntValue(CrmStr.reporttypecode); }
            set
            { AddPicklistProperty(CrmStr.reporttypecode,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string reporttypecodeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.reporttypecode); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string schedulexml
        {
            get
            { return StringPropertyValue(CrmStr.schedulexml); }
            set
            { AddStringProperty(CrmStr.schedulexml,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public string signaturedate
        {
            get
            { return DateTimePropertyValue(CrmStr.signaturedate); }
            set
            { AddDateTimeProperty(CrmStr.signaturedate,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public Guid signatureid
        {
            get
            { return UniqueIdentifierPropertyValue(CrmStr.signatureid); }
            set
            { AddUniqueIdentifierProperty(CrmStr.signatureid,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public int signaturelcid
        {
            get
            { return NumberPropertyValue(CrmStr.signaturelcid); }
            set
            { AddNumberProperty(CrmStr.signaturelcid,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public int signaturemajorversion
        {
            get
            { return NumberPropertyValue(CrmStr.signaturemajorversion); }
            set
            { AddNumberProperty(CrmStr.signaturemajorversion,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public int signatureminorversion
        {
            get
            { return NumberPropertyValue(CrmStr.signatureminorversion); }
            set
            { AddNumberProperty(CrmStr.signatureminorversion,value); }
        }

        [CrmDynAttribute(CrmStr.report)]
        public int timezoneruleversionnumber
        {
            get
            { return NumberPropertyValue(CrmStr.timezoneruleversionnumber); }
            set
            { AddNumberProperty(CrmStr.timezoneruleversionnumber,value); }
        }
    }
}